package com.liveneo.system.base.utils;

import java.util.ArrayList;
import java.util.List;
/**
 * 分页类，用来封装查询结果，以供返回分页信息
 * 
 * @author Shi Rui
 *
 * @param <T>
 */
public class PageSet<T> {
	//当前页码
	private int pageNum=1;
	//页面大小
	private int pageSize=10;
	//当前页的数据数
	private int curCount=0;
	//总条数
	private int totalCount=0;
	//总页面数
	private int totalPage=0;
	//当前页数据
	private List<T> list=new ArrayList<T>();
	
	public PageSet(int pageNum,int pageSize,int totalCount,List<T> list){
		this.pageNum=pageNum;
		this.pageSize=pageSize;
		this.totalCount=totalCount;
		this.list=list;
		if(list!=null)
			this.curCount=list.size();
		if(this.totalCount==0)
			this.totalCount=this.curCount;
		this.totalPage=totalCount/pageSize+1;
	}
	
	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public List<T> getList() {
		return list;
	}
	public void setList(List<T> list) {
		this.list = list;
	}
	public int getTotalCount() {
		return totalCount;
	}
	public int getCurCount() {
		return curCount;
	}
	public void setCurCount(int curCount) {
		this.curCount = curCount;
	}
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}
	
}
